﻿/*
 *作者：段凯强，章秀，左鹏飞
 *功能：用来解决与微博API相关的问题
 *日期：2011-08
 */
//批量收听用户：用户名列表
function wAddFriend(_friend){
	alloy.weibo.friends.add({name:_friend}, function(data){
		if (data.retcode == 0) {
			qAlert("收听成功！");
		}
		else{
			qAlert(qErrorInfo(data.retcode));
		}
	});
}
//功能：批量取消收听用户
function wDelFriend(_friend,func){
	alloy.weibo.friends.del({name:_friend}, function(data){
		if (data.retcode == 0) {
			qAlert("取消收听成功！");
			func();
		}
		else{
			qAlert(qErrorInfo(data.retcode));
		}
	});
}
//功能：批量添加特别收听用户
function wAddSpecail(_friend){
	alloy.weibo.friends.addSpecail({name: _friend}, function(data){
		qAlert("特别收听成功!");
	});
}
//批量取消特别收听
function wDelSpecail(_friend,func){
	alloy.weibo.friends.delSpecail({name:_friend}, function(data){
		if (data.retcode == 0) {
			qAlert("取消特别收听成功！");
			func();
		}
		else{
			qAlert(qErrorInfo(data.retcode));
		}
	});
}
//功能：批量添加黑名单
function wAddBlacklist(_friend){
	alloy.weibo.friends.addBlacklist({name:_friend}, function(data){
		if (data.retcode == 0) {
			qAlert("添加成功！");
		}
		else{
			qAlert(qErrorInfo(data.retcode));
		}
	});
}
//批量从黑名单移除
function wDelBlacklist(_friend,func){
	alloy.weibo.friends.delBlacklist({name:_friend}, function(data){
		if (data.retcode == 0) {
			qAlert("移除成功！");
			func();
		}
		else{
			qAlert(qErrorInfo(data.retcode));
		}
	});
}
//转换表情字符串
function exchangeMoodStr(flag,_mood){
    var orign = ["bishi","cahan","daku","fanu","fengdou","haha","kelian","kun","kuqi","liuhan","paishou","shuai","weiqu","weixiao","xixi","zaijian"];
	var exchanged = ["/鄙视","/擦汗","/流泪","/发怒","/奋斗","/呲牙","/可怜","/哈欠","/大哭","/流汗","/鼓掌","/衰","/委屈","/微笑","/可爱","/再见"];
	var i;
	if(flag){
		for(i = 0;i < orign.length;i ++){
			if(_mood == orign[i]){
				break;
			}
		}
		return exchanged[i];
	}
	for(i = 0;i < exchanged.length;i ++){
		if(_mood == exchanged[i]){
			break;
		}
	}
	return orign[i];
}
//添加新微博：表情，内容，地址，验证码，经纬度
function wAddNewWeibo(mood,detail,address,identifyingCode,lat,lng){
	var m = exchangeMoodStr(true,mood);
	var sta=true;
	alloy.weibo.tweet.add({
		content:m+"\t"+detail+"\t于"+address+"\t("+identifyingCode+"."+lat*1000000+"."+lng*1000000+")",
		jing:lng,
		wei:lat
	}, function(data){
		if (data.retcode != 0) {
			qAlert(qErrorInfo(data.retcode));
			sta=false;
		}
	});
	return sta;
}
//修改微博地址
function wModifyWeiboAddress(oldWeiboId,lat,lng){
	alloy.weibo.tweet.show({id:oldWeiboId}, function(data1){
		if(data1.retcode==0){
			var content = data1.result.origtext;
			//删除原微博
			alloy.weibo.tweet.del({id:oldWeiboId},function(data2){
				if(data2.retcode==0){
					//调整内容
					var subContent=hAnalyzeWeibo(content);
					subContent[4]=lat*1000000;
					subContent[5]=lng*1000000;
					subContent[3]=hIdentifyingCode(lat,lng,hRouteStation(lat,lng,subContent[3]));
					//重新发表
					var newContent=exchangeMoodStr(true,subContent[0])+"\t"+subContent[1]+"\t于"+subContent[2]+"\t("+subContent[3]+"."+subContent[4]+"."+subContent[5]+")";
					alloy.weibo.tweet.add({
						content:newContent,
						jing:lng,
						wei:lat
					},function(data3){
						if(data3.retcode==0){
							qAlert("修改成功！");
							toMyHome();
						}
						else{
							qAlert(qErrorInfo(data3.retcode));
						}
					});
				}
				else{
					qAlert(qErrorInfo(data2.retcode));
				}
			}); 
		}
		else{
			qAlert(qErrorInfo(data1.retcode));
		}
    });
}
//获取所有收听人列表
function wGetIdolList(){
	var index=document.getElementById("idolIndex")==null?1:parseInt(document.getElementById("idolIndex").innerHTML);
	alloy.weibo.friends.idolList({
		reqnum: 15,
		startindex: 15*(index-1)
	}, function(data){
		if(data.retcode == 0){
			var str="";
			for(var i in data.result.info){
				str+="\
	<div style='width:240px;border-top:1px solid #86bacd;background-color:#bbffff;margin-top:5px;'>\
		<div style='width:220px;height:50px;margin-left:10px;margin-top:5px;background-color:#bbffff;' onmouseover='this.style.backgroundColor=&quot;#b6eafd&quot;' onmouseout='this.style.backgroundColor=&quot;#bbffff&quot;'>\
			<div style='float:left;width:50px;height:50px;'><img title='点击查看TA的微博' style='cursor:pointer;width:50px;height:50px;' src='"+(data.result.info[i].head=="http://app.qlogo.cn"?"http://mat1.gtimg.com/www/mb/images/head_50.jpg":data.result.info[i].head+"/50")+"' onclick='toOnesWeibo(&quot;"+data.result.info[i].name+"&quot;)'/></div>\
			<div style='float:right;width:160px;height:15px;margin-top:10px;'><span style='font-size:15px;color:#ff67ff;cursor:pointer;' title='点击去TA主页' onclick='wdcGotoSee(&quot;"+data.result.info[i].name+"&quot;)' onmouseover='this.style.color=&quot;#cc34cc&quot;' onmouseout='this.style.color=&quot;#ff67ff&quot;'>"+data.result.info[i].nick+"</span><span style='font-size:10px;color:#888888;'>(@"+data.result.info[i].name+")</span></div>\
			<div style='float:right;width:160px;font-size:12px;color:#888888;margin-top:5px;'>\
			<span style='cursor:pointer;' onmouseover='this.style.textDecoration=&quot;underline&quot;,this.style.color=&quot;#0000ff&quot;' onmouseout='this.style.textDecoration=&quot;none&quot;,this.style.color=&quot;#888888&quot;' onclick='wAddSpecail(&quot;"+data.result.info[i].name+"&quot;);'>特别收听</span>|\
			<span style='cursor:pointer;' onmouseover='this.style.textDecoration=&quot;underline&quot;,this.style.color=&quot;#0000ff&quot;' onmouseout='this.style.textDecoration=&quot;none&quot;,this.style.color=&quot;#888888&quot;' onclick='wDelFriend(&quot;"+data.result.info[i].name+"&quot;,wGetIdolList);'>取消收听</span>|\
			<span style='cursor:pointer;' onmouseover='this.style.textDecoration=&quot;underline&quot;,this.style.color=&quot;#0000ff&quot;' onmouseout='this.style.textDecoration=&quot;none&quot;,this.style.color=&quot;#888888&quot;' onclick='wAddBlacklist(&quot;"+data.result.info[i].name+"&quot;);'>黑名单</span>\
			</div>\
		</div>\
	</div>";
			}
			str+="\
	<div style='width:240px;border-top:1px solid #86bacd;background-color:#bbffff;margin-top:5px;text-align:center;line-height:24px;font-size:12px;color:#888888;'>\
		<span title='首页' style='cursor:pointer;width:54px;height:24px;background-color:#bbffff;border-right:1px solid #b6eafd;float:left;' onmouseover='this.style.color=document.getElementById(&quot;idolIndex&quot;).innerHTML==1?&quot;#888888&quot;:&quot;#0000ff&quot;,this.style.backgroundColor=document.getElementById(&quot;idolIndex&quot;).innerHTML==1?&quot;#bbffff&quot;:&quot;#99dddd&quot;'\
			onmouseout='this.style.color=&quot;#888888&quot;,this.style.backgroundColor=&quot;#bbffff&quot;'"+(index==1?"":"onclick='document.getElementById(&quot;idolIndex&quot;).innerHTML=1,wGetIdolList()'")+"><<</span>\
		<span title='上一页' style='cursor:pointer;width:54px;height:24px;background-color:#bbffff;border-right:1px solid #b6eafd;float:left;' onmouseover='this.style.color=document.getElementById(&quot;idolIndex&quot;).innerHTML==1?&quot;#888888&quot;:&quot;#0000ff&quot;,this.style.backgroundColor=document.getElementById(&quot;idolIndex&quot;).innerHTML==1?&quot;#bbffff&quot;:&quot;#99dddd&quot;'\
			onmouseout='this.style.color=&quot;#888888&quot;,this.style.backgroundColor=&quot;#bbffff&quot;'"+(index==1?"":"onclick='document.getElementById(&quot;idolIndex&quot;).innerHTML="+(index-1)+",wGetIdolList()'")+"><</span>\
		<span id='idolIndex' title='页码' style='cursor:pointer;width:55px;height:24px;background-color:#bbffff;border-right:1px solid #b6eafd;float:left;'>"+index+"</span>\
		<span title='下一页' style='cursor:pointer;width:54px;height:24px;background-color:#bbffff;border-right:1px solid #b6eafd;float:left;' onmouseover='this.style.color="+(data.result.hasnext==0?"&quot;#0000ff&quot;":"&quot;#888888&quot;")+",this.style.backgroundColor="+(data.result.hasnext==0?"&quot;#99dddd&quot;":"&quot;#bbffff&quot;")+"'\
			onmouseout='this.style.color=&quot;#888888&quot;,this.style.backgroundColor=&quot;#bbffff&quot;'"+(data.result.hasnext==0?("onclick='document.getElementById(&quot;idolIndex&quot;).innerHTML="+(index+1)+",wGetIdolList()'"):"")+">></span>\
	</div>";
			document.getElementById("pFriContainer").innerHTML=str;
		}
		else{
			qAlert(qErrorInfo(data.retcode));
		}
	});
}
//获取所有特别收听人列表
function wGetSpecialList(){
	var index=document.getElementById("specIndex")==null?1:parseInt(document.getElementById("specIndex").innerHTML);
	alloy.weibo.friends.specialList({
		reqnum: 15,
		startindex: 15*(index-1)
	}, function(data){
		if(data.retcode == 0){
			var str="";
			for(var i in data.result.info){
				str+="\
	<div style='width:240px;margin-top:5px;border-top:1px solid #86bacd;background-color:#bbffff;margin-top:5px;'>\
		<div style='width:220px;height:50px;margin-left:10px;margin-top:5px;background-color:#bbffff;' onmouseover='this.style.backgroundColor=&quot;#b6eafd&quot;' onmouseout='this.style.backgroundColor=&quot;#bbffff&quot;'>\
			<div style='float:left;width:50px;height:50px;'><img title='点击查看TA的微博' style='cursor:pointer;width:50px;height:50px;' src='"+(data.result.info[i].head=="http://app.qlogo.cn"?"http://mat1.gtimg.com/www/mb/images/head_50.jpg":data.result.info[i].head+"/50")+"' onclick='toOnesWeibo(&quot;"+data.result.info[i].name+"&quot;)'/></div>\
			<div style='float:right;width:160px;height:15px;margin-top:10px;'><span style='font-size:15px;color:#ff67ff;cursor:pointer;' title='点击去TA主页' onclick='wdcGotoSee(&quot;"+data.result.info[i].name+"&quot;)' onmouseover='this.style.color=&quot;#cc34cc&quot;' onmouseout='this.style.color=&quot;#ff67ff&quot;'>"+data.result.info[i].nick+"</span><span style='font-size:10px;color:#888888;'>(@"+data.result.info[i].name+")</span></div>\
			<div style='float:right;width:160px;font-size:12px;color:#888888;margin-top:5px;'>\
			<span style='cursor:pointer;' onmouseover='this.style.textDecoration=&quot;underline&quot;,this.style.color=&quot;#0000ff&quot;' onmouseout='this.style.textDecoration=&quot;none&quot;,this.style.color=&quot;#888888&quot;' onclick='wDelSpecail(&quot;"+data.result.info[i].name+"&quot;);'>普通收听</span>|\
			<span style='cursor:pointer;' onmouseover='this.style.textDecoration=&quot;underline&quot;,this.style.color=&quot;#0000ff&quot;' onmouseout='this.style.textDecoration=&quot;none&quot;,this.style.color=&quot;#888888&quot;' onclick='wDelFriend(&quot;"+data.result.info[i].name+"&quot;,wGetSpecialList);'>取消收听</span>|\
			<span style='cursor:pointer;' onmouseover='this.style.textDecoration=&quot;underline&quot;,this.style.color=&quot;#0000ff&quot;' onmouseout='this.style.textDecoration=&quot;none&quot;,this.style.color=&quot;#888888&quot;' onclick='wAddBlacklist(&quot;"+data.result.info[i].name+"&quot;);'>黑名单</span>\
			</div>\
		</div>\
	</div>";
			}
			str+="\
	<div style='width:240px;border-top:1px solid #86bacd;background-color:#bbffff;margin-top:5px;text-align:center;line-height:24px;font-size:12px;color:#888888;'>\
		<span title='首页' style='cursor:pointer;width:54px;height:24px;background-color:#bbffff;border-right:1px solid #b6eafd;float:left;' onmouseover='this.style.color=document.getElementById(&quot;specIndex&quot;).innerHTML==1?&quot;#888888&quot;:&quot;#0000ff&quot;,this.style.backgroundColor=document.getElementById(&quot;specIndex&quot;).innerHTML==1?&quot;#bbffff&quot;:&quot;#99dddd&quot;'\
			onmouseout='this.style.color=&quot;#888888&quot;,this.style.backgroundColor=&quot;#bbffff&quot;'"+(index==1?"":"onclick='document.getElementById(&quot;specIndex&quot;).innerHTML=1,wGetSpecialList()'")+"><<</span>\
		<span title='上一页' style='cursor:pointer;width:54px;height:24px;background-color:#bbffff;border-right:1px solid #b6eafd;float:left;' onmouseover='this.style.color=document.getElementById(&quot;specIndex&quot;).innerHTML==1?&quot;#888888&quot;:&quot;#0000ff&quot;,this.style.backgroundColor=document.getElementById(&quot;specIndex&quot;).innerHTML==1?&quot;#bbffff&quot;:&quot;#99dddd&quot;'\
			onmouseout='this.style.color=&quot;#888888&quot;,this.style.backgroundColor=&quot;#bbffff&quot;'"+(index==1?"":"onclick='document.getElementById(&quot;specIndex&quot;).innerHTML="+(index-1)+",wGetSpecialList()'")+"><</span>\
		<span id='specIndex' title='页码' style='cursor:pointer;width:55px;height:24px;background-color:#bbffff;border-right:1px solid #b6eafd;float:left;'>"+index+"</span>\
		<span title='下一页' style='cursor:pointer;width:54px;height:24px;background-color:#bbffff;border-right:1px solid #b6eafd;float:left;' onmouseover='this.style.color="+(data.result.hasnext==0?"&quot;#0000ff&quot;":"&quot;#888888&quot;")+",this.style.backgroundColor="+(data.result.hasnext==0?"&quot;#99dddd&quot;":"&quot;#bbffff&quot;")+"'\
			onmouseout='this.style.color=&quot;#888888&quot;,this.style.backgroundColor=&quot;#bbffff&quot;'"+(data.result.hasnext==0?("onclick='document.getElementById(&quot;specIndex&quot;).innerHTML="+(index+1)+",wGetSpecialList()'"):"")+">></span>\
	</div>";
			document.getElementById("pSFriContainer").innerHTML=str;
		}
		else{
			qAlert(qErrorInfo(data.retcode));
		}
	});
}
//我的听众列表
function wGetFansList(){
	var index=document.getElementById("fansIndex")==null?1:parseInt(document.getElementById("fansIndex").innerHTML);
	alloy.weibo.friends.fansList({
		reqnum: 15,
		startindex: 15*(index-1)
	}, function(data){
		if(data.retcode == 0){
			var str="";
			for(var i in data.result.info){
				str+="\
	<div style='width:240px;margin-top:5px;border-top:1px solid #86bacd;background-color:#bbffff;margin-top:5px;'>\
		<div style='width:220px;height:50px;margin-left:10px;margin-top:5px;background-color:#bbffff;' onmouseover='this.style.backgroundColor=&quot;#b6eafd&quot;' onmouseout='this.style.backgroundColor=&quot;#bbffff&quot;'>\
			<div style='float:left;width:50px;height:50px;'><img style='cursor:pointer;width:50px;height:50px;' src='"+(data.result.info[i].head=="http://app.qlogo.cn"?"http://mat1.gtimg.com/www/mb/images/head_50.jpg":data.result.info[i].head+"/50")+"' "+(data.result.info[i].isidol?("title='点击查看TA的微博' onclick='toOnesWeibo(&quot;"+data.result.info[i].name+"&quot;)'"):"")+"/></div>\
			<div style='float:right;width:160px;height:15px;margin-top:10px;'><span style='font-size:15px;color:#ff67ff;cursor:pointer;' title='点击去TA主页' onclick='wdcGotoSee(&quot;"+data.result.info[i].name+"&quot;)' onmouseover='this.style.color=&quot;#cc34cc&quot;' onmouseout='this.style.color=&quot;#ff67ff&quot;'>"+data.result.info[i].nick+"</span><span style='font-size:10px;color:#888888;'>(@"+data.result.info[i].name+")</span></div>\
			<div style='float:right;width:160px;font-size:12px;color:#888888;margin-top:5px;'>"
			+(data.result.info[i].isidol?"":"<span style='cursor:pointer;' onmouseover='this.style.textDecoration=&quot;underline&quot;,this.style.color=&quot;#0000ff&quot;' onmouseout='this.style.textDecoration=&quot;none&quot;,this.style.color=&quot;#888888&quot;' onclick='wAddFriend(&quot;"+data.result.info[i].name+"&quot;,this.style.display=&quot;none&quot;);'>收听</span>")
			+"</div>\
		</div>\
	</div>";
			}
			str+="\
	<div style='width:240px;border-top:1px solid #86bacd;background-color:#bbffff;margin-top:5px;text-align:center;line-height:24px;font-size:12px;color:#888888;'>\
		<span title='首页' style='cursor:pointer;width:54px;height:24px;background-color:#bbffff;border-right:1px solid #b6eafd;float:left;' onmouseover='this.style.color=document.getElementById(&quot;fansIndex&quot;).innerHTML==1?&quot;#888888&quot;:&quot;#0000ff&quot;,this.style.backgroundColor=document.getElementById(&quot;fansIndex&quot;).innerHTML==1?&quot;#bbffff&quot;:&quot;#99dddd&quot;'\
			onmouseout='this.style.color=&quot;#888888&quot;,this.style.backgroundColor=&quot;#bbffff&quot;'"+(index==1?"":"onclick='document.getElementById(&quot;fansIndex&quot;).innerHTML=1,wGetFansList()'")+"><<</span>\
		<span title='上一页' style='cursor:pointer;width:54px;height:24px;background-color:#bbffff;border-right:1px solid #b6eafd;float:left;' onmouseover='this.style.color=document.getElementById(&quot;fansIndex&quot;).innerHTML==1?&quot;#888888&quot;:&quot;#0000ff&quot;,this.style.backgroundColor=document.getElementById(&quot;fansIndex&quot;).innerHTML==1?&quot;#bbffff&quot;:&quot;#99dddd&quot;'\
			onmouseout='this.style.color=&quot;#888888&quot;,this.style.backgroundColor=&quot;#bbffff&quot;'"+(index==1?"":"onclick='document.getElementById(&quot;fansIndex&quot;).innerHTML="+(index-1)+",wGetFansList()'")+"><</span>\
		<span id='fansIndex' title='页码' style='cursor:pointer;width:55px;height:24px;background-color:#bbffff;border-right:1px solid #b6eafd;float:left;'>"+index+"</span>\
		<span title='下一页' style='cursor:pointer;width:54px;height:24px;background-color:#bbffff;border-right:1px solid #b6eafd;float:left;' onmouseover='this.style.color="+(data.result.hasnext==0?"&quot;#0000ff&quot;":"&quot;#888888&quot;")+",this.style.backgroundColor="+(data.result.hasnext==0?"&quot;#99dddd&quot;":"&quot;#bbffff&quot;")+"'\
			onmouseout='this.style.color=&quot;#888888&quot;,this.style.backgroundColor=&quot;#bbffff&quot;'"+(data.result.hasnext==0?("onclick='document.getElementById(&quot;fansIndex&quot;).innerHTML="+(index+1)+",wGetFansList()'"):"")+">></span>\
	</div>";
			document.getElementById("pFanContainer").innerHTML=str;
		}
		else{
			qAlert(qErrorInfo(data.retcode));
		}
	});
}
//获取所有的黑名单人列表
function wGetBlackList(){
	var index=document.getElementById("blacIndex")==null?1:parseInt(document.getElementById("blacIndex").innerHTML);
	alloy.weibo.friends.blackList({
		reqnum: 15,
		startindex: 15*(index-1)
	}, function(data){
		if(data.retcode == 0){
			var str="";
			for(var i in data.result.info){
				str+="\
	<div style='width:240px;margin-top:5px;border-top:1px solid #86bacd;background-color:#bbffff;margin-top:5px;'>\
		<div style='width:220px;height:50px;margin-left:10px;margin-top:5px;background-color:#bbffff;' onmouseover='this.style.backgroundColor=&quot;#b6eafd&quot;' onmouseout='this.style.backgroundColor=&quot;#bbffff&quot;'>\
			<div style='float:left;width:50px;height:50px;'><img style='cursor:pointer;width:50px;height:50px;' src='"+(data.result.info[i].head=="http://app.qlogo.cn"?"http://mat1.gtimg.com/www/mb/images/head_50.jpg":data.result.info[i].head+"/50")+"'/></div>\
			<div style='float:right;width:160px;height:15px;margin-top:10px;'><span style='font-size:15px;color:#ff67ff;cursor:pointer;' title='点击去TA主页' onclick='wdcGotoSee(&quot;"+data.result.info[i].name+"&quot;)' onmouseover='this.style.color=&quot;#cc34cc&quot;' onmouseout='this.style.color=&quot;#ff67ff&quot;'>"+data.result.info[i].nick+"</span><span style='font-size:10px;color:#888888;'>(@"+data.result.info[i].name+")</span></div>\
			<div style='float:right;width:160px;font-size:12px;color:#888888;margin-top:5px;'>\
			<span style='cursor:pointer;' onmouseover='this.style.textDecoration=&quot;underline&quot;,this.style.color=&quot;#0000ff&quot;' onmouseout='this.style.textDecoration=&quot;none&quot;,this.style.color=&quot;#888888&quot;' onclick='wDelBlacklist(&quot;"+data.result.info[i].name+"&quot;,wGetBlackList);'>移出黑名单</span>\
			</div>\
		</div>\
	</div>";
			}
			str+="\
	<div style='width:240px;border-top:1px solid #86bacd;background-color:#bbffff;margin-top:5px;text-align:center;line-height:24px;font-size:12px;color:#888888;'>\
		<span title='首页' style='cursor:pointer;width:54px;height:24px;background-color:#bbffff;border-right:1px solid #b6eafd;float:left;' onmouseover='this.style.color=document.getElementById(&quot;blacIndex&quot;).innerHTML==1?&quot;#888888&quot;:&quot;#0000ff&quot;,this.style.backgroundColor=document.getElementById(&quot;blacIndex&quot;).innerHTML==1?&quot;#bbffff&quot;:&quot;#99dddd&quot;'\
			onmouseout='this.style.color=&quot;#888888&quot;,this.style.backgroundColor=&quot;#bbffff&quot;'"+(index==1?"":"onclick='document.getElementById(&quot;blacIndex&quot;).innerHTML=1,wGetBlackList()'")+"><<</span>\
		<span title='上一页' style='cursor:pointer;width:54px;height:24px;background-color:#bbffff;border-right:1px solid #b6eafd;float:left;' onmouseover='this.style.color=document.getElementById(&quot;blacIndex&quot;).innerHTML==1?&quot;#888888&quot;:&quot;#0000ff&quot;,this.style.backgroundColor=document.getElementById(&quot;blacIndex&quot;).innerHTML==1?&quot;#bbffff&quot;:&quot;#99dddd&quot;'\
			onmouseout='this.style.color=&quot;#888888&quot;,this.style.backgroundColor=&quot;#bbffff&quot;'"+(index==1?"":"onclick='document.getElementById(&quot;blacIndex&quot;).innerHTML="+(index-1)+",wGetBlackList()'")+"><</span>\
		<span id='blacIndex' title='页码' style='cursor:pointer;width:55px;height:24px;background-color:#bbffff;border-right:1px solid #b6eafd;float:left;'>"+index+"</span>\
		<span title='下一页' style='cursor:pointer;width:54px;height:24px;background-color:#bbffff;border-right:1px solid #b6eafd;float:left;' onmouseover='this.style.color="+(data.result.hasnext==0?"&quot;#0000ff&quot;":"&quot;#888888&quot;")+",this.style.backgroundColor="+(data.result.hasnext==0?"&quot;#99dddd&quot;":"&quot;#bbffff&quot;")+"'\
			onmouseout='this.style.color=&quot;#888888&quot;,this.style.backgroundColor=&quot;#bbffff&quot;'"+(data.result.hasnext==0?("onclick='document.getElementById(&quot;blacIndex&quot;).innerHTML="+(index+1)+",wGetBlackList()'"):"")+">></span>\
	</div>";
			document.getElementById("pBlaContainer").innerHTML=str;
		}
		else{
			qAlert(qErrorInfo(data.retcode));
		}
	});
}
//获取自己或者他人的时间线
function wGetWeibos(flag,name){
	//功能：通过API获取我最近发表的20条微博，以数组的形式返回
	if(flag){
		alloy.weibo.statuses.broadcastTimeline({
			pageflag:0,
			pagetime:0,
			reqnum:20
		},function(data){
			if(data.retcode == 0){
				weibos = hWeiboFilter(data.result.info);
				setWeiboMarker(true);
			}
		else{
			qAlert(qErrorInfo(data.retcode));
		}
		});
		return;
	}
	//功能：通过API获取其他用户最近发表的20条微博，以数组的形式返回。
	alloy.weibo.statuses.userTimeline({
		pageflag:0,
		pagetime:0,
		reqnum:20,
		lastid:0,
		name:name
	},function(data){
		if(data.retcode == 0){
			weibos = hWeiboFilter(data.result.info);
			setWeiboMarker(false);
		}
		else{
			qAlert(qErrorInfo(data.retcode));
		}
	});
}
//功能：获得单条微薄的转发理由或评论列表，并且生成详情窗口
function wGetRelist(_flag,n){
	alloy.weibo.tweet.reList({
		flag:2,
		pageflag: 0, 
		pagetime:0, 
		reqnum:20,
		rootid:weibos[n].id
	}, function(data){
		if(data.retcode==0){
			if(wdControl!=null){
				wdControl.setMap(null);
				wdControl=null;
			}
			//头像
			var _head=(weibos[n].head=="http://app.qlogo.cn"?"http://mat1.gtimg.com/www/mb/images/head_50.jpg":weibos[n].head+"/50");
			//微博内容
			var text=weibos[n].origtext;
			if(weibos[n].type==2){
				text=weibos[n].source.origtext;
			}
			var _weibo=hAnalyzeWeibo(text);
			//微博时间
			var _timeStr=hParseTime(weibos[n].timestamp);
			var _content=(weibos[n].type==2?("【转播】"+_weibo[1]):_weibo[1]);
			wdControl=mWeiboDetailControl(_flag,_head,weibos[n].nick,weibos[n].name,_content,_timeStr,_weibo[2],data.result.info,n);
			wdControl.setMap(map);
		}
		else{
			qAlert(qErrorInfo(data.retcode));
		}
	});
}
//回复一条微博
function wReply(id,text){
	alloy.weibo.tweet.reply({
		content:text,
		reid:id
	}, function(data1){
		if (data1.retcode == 0) {
			qAlert("回复成功!");
			document.getElementById("sComment").value="给点评论吧...";
			alloy.weibo.user.info(function(data2){
				if (data2.retcode == 0) {
					//评论时间
					var _timeStr=hParseTime(data1.result.time);
					document.getElementById("sCommentList").innerHTML="\
			<div style='float:left;width:430px;margin-top:10px;background-color:#b6eafd;'>\
				<div style='margin-left:10px;margin-top:5px;width:400px;'>\
				<div style='float:left;'><img title='"+data2.result.nick+"' id='dCommenterHeadImg' style='width:50px;height:50px' src='"+(data2.result.head=="http://app.qlogo.cn"?"http://mat1.gtimg.com/www/mb/images/head_50.jpg":data2.result.head+"/50")+"'/></div>\
				<div style='float:right;width:340px;margin-top:3px;'>\
				<span id='dCommenterUserName' style='color:#ff67ff;'>"+data2.result.nick+"(@"+data2.result.name+")</span>\
				<span id='dCommentTime' style='color:#888888;'>&nbsp;于&nbsp;"+_timeStr+"</span>\
				<div style='margin-top:5px;'><span id='dCommentContent' style='color:#222222;'>"+text+"</span></div>\
				</div>\
				</div>\
			</div>"+document.getElementById("sCommentList").innerHTML;
				}
				else{
					qAlert(qErrorInfo(data2.retcode));
				}
			});
		}
		else{
			qAlert(qErrorInfo(data1.retcode));
		}
	});
}



